package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "tuiyao_details", schema = "jinsanjiao", catalog = "")
public class TuiyaoDetails {
    private int tyDetailsId;
    private Long tyDetailsShuliang;
    private Long tyDetailsPrice;
    private String tyDetailsYuanyin;
    private Inventory inventoryByInventoryNumber;
    private Tuiyao tuiyaoByTyId;

    @Id
    @Column(name = "ty_details_id", nullable = false)
    public int getTyDetailsId() {
        return tyDetailsId;
    }

    public void setTyDetailsId(int tyDetailsId) {
        this.tyDetailsId = tyDetailsId;
    }

    @Basic
    @Column(name = "ty_details_shuliang", nullable = true, precision = 0)
    public Long getTyDetailsShuliang() {
        return tyDetailsShuliang;
    }

    public void setTyDetailsShuliang(Long tyDetailsShuliang) {
        this.tyDetailsShuliang = tyDetailsShuliang;
    }

    @Basic
    @Column(name = "ty_details_price", nullable = true, precision = 0)
    public Long getTyDetailsPrice() {
        return tyDetailsPrice;
    }

    public void setTyDetailsPrice(Long tyDetailsPrice) {
        this.tyDetailsPrice = tyDetailsPrice;
    }

    @Basic
    @Column(name = "ty_details_yuanyin", nullable = true, length = 30)
    public String getTyDetailsYuanyin() {
        return tyDetailsYuanyin;
    }

    public void setTyDetailsYuanyin(String tyDetailsYuanyin) {
        this.tyDetailsYuanyin = tyDetailsYuanyin;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TuiyaoDetails that = (TuiyaoDetails) o;
        return tyDetailsId == that.tyDetailsId &&
                Objects.equals(tyDetailsShuliang, that.tyDetailsShuliang) &&
                Objects.equals(tyDetailsPrice, that.tyDetailsPrice) &&
                Objects.equals(tyDetailsYuanyin, that.tyDetailsYuanyin);
    }

    @Override
    public int hashCode() {
        return Objects.hash(tyDetailsId, tyDetailsShuliang, tyDetailsPrice, tyDetailsYuanyin);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "ty_id", referencedColumnName = "ty_id")
    public Tuiyao getTuiyaoByTyId() {
        return tuiyaoByTyId;
    }

    public void setTuiyaoByTyId(Tuiyao tuiyaoByTyId) {
        this.tuiyaoByTyId = tuiyaoByTyId;
    }
}
